import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import '@/assets/reset.css'
import '@/utils/element'
import axios from 'axios'
Vue.prototype.axios = axios
import SkeleonView from '@/components/utils/SkeleonView.vue'
Vue.component('SkeleonView', SkeleonView)
Vue.config.productionTip = false
import message from '@/components/utils/message/message'
Vue.prototype.$message = message
import layzImg from '@/assets/404.gif'

import tan from '@/components/utils/Dialog/index'
Vue.prototype.$confirm = tan
Vue.directive('lazy', {
  inserted(el, banding) {
    const observe = new IntersectionObserver(([{ isIntersecting }]) => {
      if (isIntersecting) {
        observe.unobserve(el)
        el.src = banding.value
        el.onerror = () => {
          el.src = layzImg
        }
      }
    })
    observe.observe(el)
  }
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
